//
//  HJPushModel.m
//  project
//
//  Created by yefei on 2019/5/22.
//  Copyright © 2019 健健. All rights reserved.
//

#import "HJPushModel.h"

@implementation HJPushModel

+ (nullable NSDictionary<NSString *, id> *)modelCustomPropertyMapper {
    
    return @{@"content":@"description"};
}

+ (nullable NSDictionary<NSString *, id> *)modelContainerPropertyGenericClass {
    return @{@"custom_content": [CustomModel class]};
}

- (NSString *)description {
    return [self yy_modelDescription];
}
@end



@implementation CustomModel

- (BOOL)modelCustomTransformFromDictionary:(NSDictionary *)dic {
    
    [self transformProperties];
    
    return YES;
}

- (NSString *)description {
    return [self yy_modelDescription];
}

-(void)transformProperties {
    // 根据用户id获取名字
    if (!self.userId.length) return;
    NSString * url = [Api stringByAppendingString:QueryByIdApi];
    @weakify(self)
    [HJHttpTool get:url params:@{@"userId":self.userId} success:^(HJResponeds *result) {
        @strongify(self)
        HJUserModel *model = [HJUserModel yy_modelWithJSON:result.data];
        self.nickName = model.nickName;
        self.avator = model.avatar;
    } failure:^(id result) {
    }];
}
@end
